package com.longjianghuasheng.logistics.business.freight.adapter

import com.blankj.utilcode.util.ColorUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseDataBindingHolder
import com.longjianghuasheng.logistics.R
import com.longjianghuasheng.logistics.business.home.TypeResponse
import com.longjianghuasheng.logistics.databinding.ItemTypeTabBinding
import com.longjianghuasheng.logistics.ext.loadUrl

class TypeAdapter :
    BaseQuickAdapter<TypeResponse, BaseDataBindingHolder<ItemTypeTabBinding>>(R.layout.item_type_tab) {

    override fun convert(holder: BaseDataBindingHolder<ItemTypeTabBinding>, item: TypeResponse) {
        holder.dataBinding?.run {


            tvTab.setTextColor(ColorUtils.getColor(if (item.isChecked) R.color.white else R.color.blue9E))
            ivTab.loadUrl(if (item.isChecked) item.picurl2 else item.picurl)
            tvTab.text=item.title
        }
    }
}